<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>天行勇士首页</title>
		<link type="text/css" rel="styleSheet" href="../css/base.css" />
		<link type="text/css" rel="styleSheet" href="../css/index.css" />
		<script src="../js/jquery-3.4.1.js" type="application/javascript"></script>
		<script src="../js/data.js" type="application/javascript"></script>
		<script type="application/javascript">
			$(function() {
				let deck = CommonUtil.getDeckStorage();
				let player = CommonUtil.getPlayerStorage();
				if (deck == null || player == null) {
					$("#todeck").hide();
					$("#totask").hide();
					$("#todeckadjust").hide();
					$("#toplayer").hide();
				}
				if (deck == null && player != null) {
					$("#todeck").show();
					$("#toplayer").show();
				}
				if (deck != null && player != null) {
					$("#todeck").hide();
				}

				$("#restart").on("click", function() {
					let r = confirm("你确定要初始化游戏？");
					if (r == true) {
						CommonUtil.clearStorage();
						// CommonUtil.initDeckStorage();
						CommonUtil.initPlayerStorage();
						CommonUtil.initTaskState();
						location.reload();
					} else {

					}
				});
				$("#totask").on("click", function() {
					location.href = "tasklist.html";
				});
				$("#tomonster").on("click", function() {
					location.href = "monsters.html";
				});
				$("#tocard").on("click", function() {
					location.href = "cards.html";
				});
				$("#todeck").on("click", function() {
					location.href = "deckinit.html";
				});
				$("#todeckadjust").on("click", function() {
					location.href = "deckadjust.html";
				});
				$("#toplayer").on("click", function() {
					location.href = "player.html";
				});
			});
		</script>
	</head>
	<body>
		<div class="title">天行勇士</div>
		<div class="menu_item" id="toplayer">玩 家 信 息</div>
		<div class="menu_item" id="todeck">卡 组 初 始 化</div>
		<div class="menu_item" id="todeckadjust">卡 组 调 整</div>
		<div class="menu_item" id="totask">任 务</div>

		<div class="menu_item" id="tocard">卡 牌 图 鉴</div>
		<div class="menu_item" id="tomonster">怪 兽 图 鉴</div>
		<div class="menu_item" id="restart">重 新 开 始</div>
	</body>
</html>
